using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using WP.Modules;
using WP.Commons;
using WP.DB;

namespace MaxLeaf
{
    public partial class frmUserConfigure : Form
    {
        public enum Type
        {
            Export = 0,
            Import
        }
        private Type mType;

        public frmUserConfigure()
        {
            InitializeComponent();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {

        }

        private void btnExit_Click(object sender, EventArgs e)
        {

        }

        private void cmdFile_Click(object sender, EventArgs e)
        {
            string strPath = string.Empty;

            //    strPath = DataFunctions.GetmMiscValue("EDIImportPath", "M");
            //    strPath = DataFunctions.GetmMiscValue("EDIExportPath", "M");

            if (strPath.Equals(string.Empty))
            {
                strPath = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments );
            }

            if (mType == Type.Export)
            {
                CDlgFileOpen.InitialDirectory = strPath;
                if (CDlgFileOpen.ShowDialog() == DialogResult.OK)
                {
                    txtFileName.Text = CDlgFileOpen.FileName;
                }
            }
            else
            {
                CDlgFileSave.InitialDirectory = strPath;
                if (CDlgFileSave.ShowDialog() == DialogResult.OK)
                {
                    txtFileName.Text = CDlgFileSave.FileName;
                }
            }
        }

        private void InitControl()
        {
            DBAccess dBAccess = new DBAccess(false, false);

            txtFileName.Text = "";


            if (mType == Type.Export)
            {
                string strPath = string.Empty;
                //DataFunctions.GetmMiscValue(db, "EDIExportPath", "M");
                if (!strPath.Equals(string.Empty))
                {
                    if (strPath.EndsWith(@"\"))
                    {
                        txtFileName.Text = strPath;
                    }
                    else
                    {
                        txtFileName.Text = strPath + @"\";
                    }
                }
            }
            //if (mType == EDIType.R850)
            //{
            //    this.Text = "Import EDI 850";
            //}

            dBAccess.CloseCon();
        }
    }
}